#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'分割'
import re

# 传统：
arr1 = 'a b c d'.split(' ')
print(arr1)  # ['a', 'b', 'c', 'd']

# re带正则表达式的split
arr2 = re.split(r'\s', 'a b c d')
print(arr2)  # ['a', 'b', 'c', 'd']

arr3 = re.split(r'[\s\,]', 'a b,c d,e')
print(arr3)  # ['a', 'b', 'c', 'd', 'e']
